<template>
  <div id="app">
    <div class="app_top" @click="shopClick">
      <div class="app_top_shop">
        <img :src="shop.avatar" alt="" />
        <div>
          <p>
            <van-button
              type="danger"
              style="margin: 2px 4px 0 0; vertical-align: middle"
              size="mini"
              >品牌</van-button
            >{{shop.name}}
          </p>
          <p style="font-size:14px">{{shop.description}} / {{shop.deliveryTime}}分钟送达</p>
          <p>
            <van-button
              type="primary"
              color="red"
              plain
              style="
                margin-top: -10px;
                vertical-align: middle;
                margin: 2px 4px 0 0;
                font-size: 14px;
                height: 20px;
              "
              size="mini"
              >减</van-button
            >
            <span class="active" style="vertical-align: middle;font-size:14px">{{supports}}</span>
            <span class="actNum">{{supplength}}个 &gt;</span>
          </p>
        </div>
      </div>

      <div class="app_top_notice">
        <van-button type="primary" style="margin: 2px 10px 0 0" size="mini"
          >公告</van-button
        >
        <p>
          {{shop.bulletin}}
        </p>
        <van-icon name="arrow" style="line-height: 30px" />
      </div>
    </div>

    <div class="app_main">
      <div class="app_nav">
        <span :class="classShow1" @click="tabclick(1)"><router-link to="/" >商品</router-link></span>
        <span :class="classShow2" @click="tabclick(2)"><router-link to="/assess">评价</router-link></span>
        <span :class="classShow3" @click="tabclick(3)"><router-link to="/bussiness">商家</router-link></span>
      </div>
      <router-view></router-view>
    </div>



  <!-- 店铺蒙层 -->
    <div id="shopMask" v-show="maskShow" @click="shopMaskClick">
      <div style="text-align: center; font-size:24px ;line-height:40px">
        <p>乡村基</p>
        <van-rate v-model="value" allow-half void-icon="star" gutter='20px' void-color="#eee" color="#ffd21e"  :size="25"/>
      </div>
      <div style="padding:0 20px"> 
        <van-divider><span style="color:#fff; font-size:20px;">优惠信息</span></van-divider>
         <p style="margin-bottom:20px" v-for="item in shop.supports" :key="item.id">
           <van-button
              type="primary"
              color="red"
              plain
              style="
                vertical-align: middle;
                margin: 2px 4px 0 0;
                font-size: 14px;
                height: 20px;
              "
              size="mini"
              >减</van-button
            >
            {{item}}
         </p>
      </div>
      <div  style="padding:0 20px">
        <van-divider><span style="color:#fff; font-size:20px;">商家公告</span></van-divider>
        <p>{{shop.bulletin}}</p>
      </div>
    </div>
  </div>
</template>


<script>
import {shopseller} from '../src/apis/apis'
export default {
  data() {
    return {
      shop:[],
      maskShow: false, //模态框
      value: null, //评分
      supports:'',//优惠活动
      supplength:'',//优惠活动个数
      classShow1:'',
      classShow2:'',
      classShow3:'',
    };
  },
  methods: {
    shopClick(){
      this.maskShow=true
    },
    shopMaskClick(){
      this.maskShow=false
    },
    tabclick(){
    
    }
  },
  created(){
    shopseller({}).then(res=>{
      // console.log(res.data.data);
      if(res.status==200){
        this.shop = res.data.data
        this.value = res.data.data.score
        this.supplength = res.data.data.supports.length
        this.supports = res.data.data.supports.join(' ')
      }
      // console.log(this.shop);
    })
  }
};
</script>


<style lang="less">
* {
  margin: 0;
  padding: 0;
}
a{
  color: #000;
}
html,
body {
  height: 100%;
}

#app {
  #shopMask{
    padding: 30px 0;
    width: 100%;
    height: 100%;
    position: fixed;
    top: 0;
    left: 0;
    background: rgba(0, 0, 0, 0.9);
    color: #fff;
}
  height: 100%;
  .app_top {
    height: 130px;
    background: #ffcc00;
    display: flex;
    flex-direction: column;

    .app_top_shop {
      color: #fff;
      flex: 1;
      display: flex;
      padding: 10px 20px;
      img {
        width: 80px;
        height: 80px;
        margin-right: 20px;
        border-radius: 10px;
      }
      div {
        p {
          margin-bottom: 2px;
          .active {
            display: inline-block;
            width: 150px;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
          }

          .actNum {
            background: rgba(0, 0, 0, 0.2);
            display: inline-block;
            padding: 2px 6px;
            color: #fff;
            border-radius: 20px;
          }
        }
      }
    }

    .app_top_notice {
      color: #fff;
      font-size: 14px;
      padding: 0 10px;
      height: 30px;
      background: rgba(0, 0, 0, 0.2);
      display: flex;

      p {
        width: 290px;
        line-height: 30px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
      }
    }
  }
  .app_nav {
    display: flex;
    justify-content: space-around;
    margin-bottom: 1px;
    a {
      display: inline-block;
      padding: 10px;
    }
  }
  .app_main {
    height: 100%;
    display: flex;
    flex-direction: column;
  }

  .app_bottom {
    background: #000;
    border-radius: 30px;
    width: 100%;
    height: 60px;
    position: fixed;
    bottom: 10px;
    left: 0;
    color: #fff;
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 99999999999;
  }

  .on {
    font-weight: bold;
    
    border-bottom: 4px solid #ffcc00;
    a{
      color: #ffcc00;
    }
  }
}
</style>
